package org.tloss.web.editor.database.editors;

import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;

public class DatabaseConfigLableProvider extends LabelProvider implements
		ITableLabelProvider {

	@Override
	public Image getColumnImage(Object element, int columnIndex) {
		return null;
	}

	@Override
	public String getColumnText(Object element, int columnIndex) {
		if (element instanceof DatabaseConfig) {
			DatabaseConfig config = (DatabaseConfig) element;
			switch (columnIndex) {
			case 0:
				return config.getName();
			case 1:
				return config.getLabelValue() != null ? (config.getLabelValue() instanceof Integer ? String
						.valueOf(((Integer) config.getLabelValue()) > 0)
						: config.getLabelValue().toString())
						: "";

			}
		}
		return "";
	}

}
